package cn.gzmli.dtt.common.controll;


import cn.gzmli.dtt.common.config.cache.Config;
import cn.gzmli.dtt.common.utils.Constant;
import cn.gzmli.dtt.common.entity.FaqMessage;
import cn.gzmli.dtt.common.entity.PageInfo;
import cn.gzmli.dtt.common.entity.Result;
import cn.gzmli.dtt.common.entity.User;
import cn.gzmli.dtt.common.service.FaqMessageService;
import cn.gzmli.dtt.common.utils.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;

/**
 * @author Yzz
 */
@Controller
@RequestMapping("/faq_message")
public class FaqMessageController  implements BaseController<FaqMessage> {


    @Autowired
    private FaqMessageService faqMessageService;

    @Override
    public Result lists(HttpServletRequest request, PageInfo pageInfo) throws Exception {
        return null;
    }

    @Override
    public Result save(FaqMessage faqMessage) throws Exception {
        return null;
    }

    @RequestMapping("/commit")
    @ResponseBody
    public Result save(FaqMessage faqMessage, HttpServletRequest request) throws Exception {
        User curUser= Config.getUser(request);
        faqMessage.setTime(new Date());
        faqMessage.setUser(curUser.getId().toString());
        faqMessage.setType("无");
        faqMessageService.save(faqMessage);
        return new Result(Constant.SUCCESS,"成功");
    }

    @Override
    public Result update(FaqMessage faqMessage) throws Exception {
        return null;
    }

    @Override
    public Result delete(FaqMessage faqMessage) throws Exception {
        return null;
    }

    @Override
    public Result get(Integer id) throws Exception {
        return null;
    }

    @Override
    public Result list() throws Exception {
        return null;
    }

    @Override
    public Result listByCondition(HttpServletRequest request, PageInfo pageInfo) throws Exception {
        return null;
    }

    @Override
    public Result getByCondition(HttpServletRequest request) throws Exception {
        return null;
    }
}
